package com.ykdl.member.kid.fittool;

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;

import com.umeng.analytics.MobclickAgent;
import com.ykdl.member.KidApp;
import com.ykdl.member.kid.image.ImageLoader;

public class BaseActivity extends Activity {
	private boolean mResumed = false;
	private String mActivityName = this.toString();

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		KidApp.getInstance().getAppManager().addActivity(this);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
	}

	@Override
	protected void onStart() {
		super.onStart();
		KidApp.getInstance().setCurrentActivity(this);
	}

	@Override
	protected void onResume() {
		MobclickAgent.onPageStart("SplashScreen");
		 MobclickAgent.onResume(this);   
		mResumed = true;
		ImageLoader.getInstance().setCurrentActivity(getActivityName());
		super.onResume();
	}

	@Override
	protected void onPause() {
		MobclickAgent.onPageEnd("SplashScreen"); 
		 MobclickAgent.onPause(this);
		mResumed = false;
		ImageLoader.getInstance().pause(getActivityName());
		super.onPause();
	}

	@Override
	protected void onDestroy() {
		ImageLoader.getInstance().cancel(getActivityName());
		super.onDestroy();
	}

	public boolean isActive() {
		return mResumed;
	}


	protected boolean needCheckUpdate() {
		return true;
	}

	public String getActivityName() {
		return mActivityName;
	}
}
